'''
@author: Aurelien Deharbe


This file is part of Cute-Server.

Cute-Server is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Cute-Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Cute-Server.  If not, see <http://www.gnu.org/licenses/>.
'''

class CClientData(object):

    def __init__(self, host):
        self.sessions = []
        self._host = host
        self._waiting_port = False
    
    def openSession(self, sessiondata):
        if self._waiting_port:
            return False
        self.sessions.append(sessiondata)
        self._waiting_port = True
        return True
    
    def sessionPort(self, port):
        if not self._waiting_port:
            return False
        self.sessions[-1].connectClient(self._host, port)
        return True
    
    def closeSessions(self):
        for sess in self.sessions:
            sess.removeClient(self)



if __name__ == '__main__':
    print "Please use the cuteserver script to run it"
